/**
 * Created by Administrator on 15-7-31.
 */
var Editor = RichBase.extend({
	statics : {},
	EVENTS : {
		"click" : {
			"#editDetail" : "onEditorOpen",
			"#editorPopBox .btn_surec" : "onEditorSave",
			"#editorPopBox .btn_cancelc" : "onEditorClose"
		}
	},
	init : function(){
		var that = this;
		window.onload = function(){
			var wh = $(window).height();
			var editorH = wh - 300;
			window.UEDITOR_CONFIG.initialFrameHeight = editorH;
			that.editor = UE.getEditor('detailInfo');
		};
	},
	setContent : function(content){
		if(!content) return false;
		this.editor.setContent(content);
	},
	onEditorOpen : function(that,e){
		var content = $("#jdjj").html();
		that.setContent(content);
		that.show();
	},
	onEditorClose : function(that,e){ that.hide()},
	onEditorSave : function(that,e){
		var ue = that.editor;
		var contentText = ue.getContentTxt();
		var content = ue.getContent();
		$("#richContent").html(contentText);
		$("#detailInfo").val(content);
		$("#jdjj").html(content);
		$("#detailInfoTextarea").val(content);
		that.hide();
	},
	show : function(){
		Pop.show($("#editorPopBox"));
	},
	hide : function(){
		Pop.hide($("#editorPopBox"));
	}
})
